import axios from '@/utils/myaxios';

// 获取城市信息
export const airsCity = name => {
  return axios({
    url: '/airs/city',
    params: { name }
  });
};

// 获取机票信息
export const airs = params => {
  return axios({
    url: '/airs',
    params
  });
};


// 获取特价机票信息
export const airsSale = params => {
  return axios({
    url: '/airs/sale'
  });
};

// 选择机票
export const selectAir = (id, seat_xid) => {
  return axios({
    url: `/airs/${id}`,
    params: { seat_xid }
  });
};

// 提交订单
export const sendAir = (data, token) => {
  return axios({
    method: 'post',
    url: `/airorders`,
    headers: {
      Authorization: 'Bearer ' + token
    },
    data
  });
};

// 获取订单详情
export const airordersByid = (id, token) => {
  return axios({
    url: `/airorders/${id}`,
    headers: {
      Authorization: 'Bearer ' + token
    },
  });
};

// 查询订单状态
export const checkpay = (data, token) => {
  return axios({
    method: 'post',
    url: `/airorders/checkpay`,
    headers: {
      Authorization: 'Bearer ' + token
    },
    data
  });
};